# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=sippts
pkgver=v4.1.2.r4.g57d7f8d
pkgrel=1
epoch=1
pkgdesc='Set of tools to audit SIP based VoIP Systems.'
groups=('blackarch' 'blackarch-voip')
arch=('any')
url='https://github.com/Pepelux/sippts'
license=('custom:unknown')
depends=('python' 'python-netifaces' 'python-ipy' 'python-pyshark'
         'python-scapy' 'python-arpspoof' 'python-websocket-client' 'python-rel'
         'python-pyradamsa')
makedepends=('git' 'python-pip' 'python-build' 'python-wheel')
source=("git+https://github.com/Pepelux/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  ( set -o pipefail
    git describe --long --tags --abbrev=7 2>/dev/null |
      sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
    printf "%s.%s" "$(git rev-list --count HEAD)" \
      "$(git rev-parse --short=7 HEAD)"
  )
}

build() {
  cd $pkgname

  python -m build --wheel --outdir="$startdir/dist"
}

package() {
  cd $pkgname

  pip install \
    --verbose \
    --disable-pip-version-check \
    --no-warn-script-location \
    --ignore-installed \
    --no-compile \
    --no-deps \
    --root="$pkgdir" \
    --prefix=/usr \
    --no-index \
    --find-links="file://$startdir/dist" \
    $pkgname

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  #mv "$pkgdir/usr/bin/arpspoof" "$pkgdir/usr/bin/$pkgname-arpspoof"
}

